<?php
/**
 * Модель shop_module
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель shop_module
 *
 */
class ModelShop_module extends Model {
	
	const TABLE				 = 'shop_module';
	const F_SHOP_MODULE_ID   = 'shop_module_id';
	const F_SHOP_ID  	     = 'shop_id';
	const F_MODULE_ID  	     = 'module_id';
	const F_MODULE_SETTINGS  = 'module_settings';
	const F_PUBLISH  	     = 'publish';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='shop_module';
		$this->id_field=array(self::F_SHOP_MODULE_ID);
		$this->fields=array(
		self::TABLE.DOT.self::F_SHOP_MODULE_ID=> new Field($this,self::F_SHOP_MODULE_ID,self::TABLE,array(
				'auto'=>true,
				'important'=>true,
				'lenght'=>11)),
		self::TABLE.DOT.self::F_SHOP_ID=> new Field($this,self::F_SHOP_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>9,
				'join_table'=>'shop')),
		self::TABLE.DOT.self::F_MODULE_ID=> new Field($this,self::F_MODULE_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>4,
				'join_table'=>'module')),
		self::TABLE.DOT.self::F_MODULE_SETTINGS=> new Field($this,self::F_MODULE_SETTINGS,self::TABLE,array(
				'important'=>true,
				'type'=>Field::TYPE_TEXT)),
		self::TABLE.DOT.self::F_PUBLISH=> new Field($this,self::F_PUBLISH,self::TABLE,array(
				'important'=>true,
				'lenght'=>1,
				'type'=>Field::TYPE_STRING,
				'validate_type'=>Validator::VALIDATE_HASH))		);
	}
}
